//设置cookie
function setCookie(name, value, exDays) {
	var d = new Date();
	d.setDate(d.getDate() + exDays);
	document.cookie = name + "=" + value + "; " + "expires=" + d + "; ";
}
//读取cookie
function getCookie(name) {
	var cookies = document.cookie; //document.cookie = "name=zhangsan; age=23"; 
	var arr = cookies.split("; "); //先将字符串按照; 分隔为数组，数组的每一项就是一个cookie
	for(var i = 0; i < arr.length; i++) {
		var targetArr = arr[i].split("="); //假设要求的是键值为age的时候的对应的值，targetArr = 
		if(targetArr[0] == name) {
			return targetArr[1];
		}
	}
}
//删除cookie
function removeCookie(name) {
	setCookie(name, "", -1); //如果设置时间是以前时间的就立刻失效
}